package com.example.administrator.shzs.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.administrator.shzs.R;
import com.example.administrator.shzs.entity.IntegraDetailData.IntegraDataList;

import java.util.List;

/**
 * Created by Administrator on 2016/11/4.
 *
 * 积分详情
 */

public class IntegraDetialAdapter extends RecyclerView.Adapter<IntegraDetialAdapter.MyViewHolder>{

    private Context context;
    private List<IntegraDataList> integraDataLists;

    public IntegraDetialAdapter(Context context, List<IntegraDataList> integraDataLists) {
        this.context = context;
        this.integraDataLists = integraDataLists;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view=View.inflate(context, R.layout.integra_item,null);

        MyViewHolder holder=new MyViewHolder(view);

        return holder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {

        holder.tvIntegra.setText(integraDataLists.get(position).getPoint());
        holder.tvContent.setText(integraDataLists.get(position).getComment());
        holder.tvDate.setText(integraDataLists.get(position).getPostTime());
    }

    @Override
    public int getItemCount() {
        return integraDataLists == null ? 0 :integraDataLists.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder{

        private TextView tvIntegra;//积分
        private TextView tvContent;//内容
        private TextView tvDate;//时间

        public MyViewHolder(View itemView) {
            super(itemView);

            tvIntegra= (TextView) itemView.findViewById(R.id.tv_integra_integra_item);
            tvContent= (TextView) itemView.findViewById(R.id.tv_content_integra_item);
            tvDate= (TextView) itemView.findViewById(R.id.tv_date_integra_item);

        }

    }

}
